package com.pay.controller.ali;

import com.pay.model.Goods;
import com.pay.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;


/**
 *
 */
@RestController
public class AliController {

    @Autowired
    private GoodsService goodsService;

    @RequestMapping(value = "api/aliPay")
    public ResponseEntity aliPay() {
        List<Goods> listGoods = goodsService.findListGoods();
        if (listGoods!=null){
        ResponseEntity<List<Goods>> body = ResponseEntity.status(HttpStatus.CREATED).body(listGoods);
        return body;
        }
        return (ResponseEntity) ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE);
    }
}
